import { createApp } from "vue";
import ElementPlus from "element-plus"; //全局引入
import "element-plus/dist/index.css";
import router from "./router/index";
import axios from "./utils/request";
import App from "./App.vue";
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';
import highlight from 'highlight.js';
import { createPinia } from 'pinia';
import piniaPluginPersist from 'pinia-plugin-persist'

// 创建pinia
const pinia = createPinia();

//pinia持久化
pinia.use(piniaPluginPersist)
const app = createApp(App);
app.use(highlight);
app.directive("highlight", (el) => {
  let blocks = el.querySelectorAll("pre code");
  blocks.forEach((block) => {
    highlight.highlightBlock(block);
  });
});
//使用pinia
app.use(pinia);
app.use(Avue);
app.use(router);
app.use(ElementPlus);
app.config.warnHandler = () => {};
app.mount("#app");
app.config.globalProperties.$axios = axios; //配置axios的全局引用
